home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2.0 - Programmer's Utilities Power Pack / Delphi 2.0 Programmer's Utilities Power Pack.iso / e_to_l / fccopy / fctest.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-09-15  |  8.1 KB  |  177 lines

  1. (*********************************************************************)
  2. (*********************************************************************)
  3. (** FCTEST.PAS - Test unit for the TASP Development Delphi ***********)
  4. (** (tnx Borland!!!) File Copy Component. ****************************)
  5. (*********************************************************************)
  6. (*********************************************************************)
  7. (*                                                             *******)
  8. (* The TASP Filecopy Component is a product of:                *******)
  9. (*                                                             *******)
  10. (* Daniel J. Karnes                                            *******)
  11. (* 9942 W. Broadway Suite 209                                  *******)
  12. (* Anaheim, CA 92804                                           *******)
  13. (*                                                             *******)
  14. (* Email: TASP@TASP.NET  or  TASPEngr@AOL.COM                  *******)
  15. (*                                                             *******)
  16. (* FCTEST and FILECOPY are distributed as try-before-you-buy   *******)
  17. (* SHAREWARE. Registration is expected if you continue using   *******)
  18. (* this TASP Development product beyond a free 7 days period   *******)
  19. (* of evaluation. Please support SHAREWARE and we'll all win!  *******)
  20. (*                                                             *******)
  21. (* REGISTRATION FEES:                                          *******)
  22. (*                                                             *******)
  23. (* $15.00 - Single user. NON COMMERCIAL.                       *******)
  24. (*                                                             *******)
  25. (* $27.00 - Shareware author's license.                        *******)
  26. (*                                                             *******)
  27. (* $79.00 - Commercial license.                                *******)
  28. (*                                                             *******)
  29. (* All others must email for a quote before using.             *******)
  30. (*                                                             *******)
  31. (* Please register today! You'll get a laser printed manual    *******)
  32. (* and reference along with a registered copy of the product   *******)
  33. (* (no nagware notice and more features & speed!) on disk or   *******)
  34. (* via email if you specify.                                   *******)
  35. (*                                                             *******)
  36. (* Send registrations to:                                      *******)
  37. (*                                                             *******)
  38. (* Daniel J. Karnes                                            *******)
  39. (* 9942 W. Broadway Suite 209                                  *******)
  40. (* Anaheim, CA 92804                                           *******)
  41. (*                                                             *******)
  42. (* *** IF EVERYONE SUPPORTS SHAREWARE WE'LL ALL MAKE OUT!! *** *******)
  43. (*                                                             *******)
  44. (*******                                                       *******)
  45. (*******           DISCLAIMER AND COPYRIGHT NOTICE             *******)
  46. (*******                                                       *******)
  47. (*                                                             *******)
  48. (* Using this example program or any other part of this        *******)
  49. (* software is agreeing to not holding the author thereof to   *******)
  50. (* any form of warranty or guarantee whether expressed or      *******)
  51. (* implied. Continuing to use this example program or any      *******)
  52. (* part of the accompanying software is also agreement that    *******)
  53. (* compiling and or implementing any part of this program is   *******)
  54. (* an action that any user will be undertaking at the users    *******)
  55. (* own personal risk and liability.                            *******)
  56. (*                                                             *******)
  57. (* Any user of this example program or any other part of this  *******)
  58. (* original distribution is expressely agreeing to all terms   *******)
  59. (* and conditions stated by the author if the user implements  *******)
  60. (* any part of this software in any way.                       *******)
  61. (*                                                             *******)
  62. (* WHEW! And my attorney even likes it! ;)  I just hope that   *******)
  63. (* *you* like the software!                                    *******)
  64. (*                                                             *******)
  65. (* Let me know if you like it. (the SOFTWARE!) Think it sucks  *******)
  66. (* Or want more!                                               *******)
  67. (*                                                             *******)
  68. (* djk@TASP.NET / TASP@TASP.NET / TASPEngr@AOL.COM             *******)
  69. (*                                                             *******)
  70. (* Send registrations to:                                      *******)
  71. (*                                                             *******)
  72. (* Daniel J. Karnes                                            *******)
  73. (* 9942 W. Broadway Suite 209                                  *******)
  74. (* Anaheim, CA 92804                                           *******)
  75. (*                                                             *******)
  76. (* Of course comments and suggestions are solicited!           *******)
  77. (*                                                             *******)
  78. (*********************************************************************)
  79. (*********************************************************************)
  80. (*********************************************************************)
  81. (*********************************************************************)
  82.  
  83. UNIT Fctest;
  84.  
  85. INTERFACE
  86.  
  87. USES
  88.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  89.   Forms, Dialogs, Filecopy;
  90.  
  91. TYPE
  92.   TTestProgram = Class(TForm)
  93.     FileCopy1: TFileCopy;
  94.     procedure FormActivate(Sender: TObject);
  95.     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  96.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  97.   private
  98.     { Private declarations }
  99.   public
  100.     { Public declarations }
  101.     procedure FComplete(var Sender : TObject); message fc_CopyComplete;
  102.     procedure FCError(var Message : TMessage); message fc_ErrorDetected;
  103.   end;
  104.  
  105. VAR TestProgram: TTestProgram;
  106.  
  107. CONST
  108.   RegisterTASPFileCopyToday : TCloseAction = caFree; {NOT!}
  109.  
  110. IMPLEMENTATION
  111.  
  112. {$R *.DFM}
  113.  
  114. Procedure TTestProgram.FormActivate(Sender: TObject);
  115. BEGIN
  116.   FileCopy1.Source:=('c:\temp\source.zip');  { set the source file }
  117.   FileCopy1.Target:=('c:\temp\target.zip');  { set the target file }
  118.    MyFrigginHandle:=(Handle);       { let FileCopy know your windows handle! }
  119.   FileCopy1.SaveAttribs:=(True);    { manually set some properties..}
  120.   FileCopy1.CheckDiskSpace:=(True); { " " }
  121.   FileCopy1.CRCCheck:=(True);       { " " }
  122.   FileCopy1.HourGlass:=(True);      { " " }
  123.   FileCopy1.CopyFiles(Sender);      { call the copy routines! }
  124. END;
  125.  
  126. Procedure TTestProgram.FComplete(var Sender : TObject);
  127. BEGIN
  128.   Close;                            { one guess.. }
  129. END;
  130.  
  131. Procedure TTestProgram.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  132. BEGIN
  133.   CanClose:=(RegisterTASPFileCopyToday=caFree); {good idea!}
  134. END;
  135.  
  136. Procedure TTestProgram.FormClose(Sender: TObject; var Action: TCloseAction);
  137. BEGIN
  138.   Action:=(RegisterTASPFileCopyToday); {another good idea!}
  139. END;
  140.  
  141. Procedure TTestProgram.FCError(var Message : TMessage);
  142. Var s : String;
  143. BEGIN
  144.  
  145. s:='';
  146.  
  147.   CASE Message.wParam OF
  148.  
  149.     1 : begin
  150.          s:='File Already Exists!';
  151.         end;
  152.     2 : begin
  153.           s:='Disk Full.';
  154.         end;
  155.     3 : begin
  156.           s:='CRC Test Failed.';
  157.         end;
  158.     4 : begin
  159.           s:='Source file not found!';
  160.         end;
  161.     5 : begin
  162.           s:='Target file already exists!';
  163.         end;
  164.  
  165.  end;
  166.  
  167. IF (s>'') THEN
  168. BEGIN
  169.  MessageBeep(mb_IconAsterisk);
  170.  MessageDlg(s,mtError,[mbOk],0);
  171.  Halt(2);
  172. END;
  173.  
  174. END;
  175.  
  176. END.
  177.